package com.appspot.codelab.docs.client.commands;

import com.appspot.codelab.docs.client.widgets.Dialog;
import com.appspot.codelab.docs.editor.advanced.client.parts.EditorPart.SyntaxHandler;

/**
 * A command for setting the syntax parser.
 */
public class SystemSetSyntaxParserCommand extends Command {

  /**
   * The command's unique id.
   */
  public final static int serialUid = 200;
  
  protected SyntaxHandler parser;
  
  /**
   * Constructs a command for setting the syntax parser.
   * 
   * @param parser the syntax parser.
   */
  public <T extends Dialog> SystemSetSyntaxParserCommand(SyntaxHandler parser) {
	super("Set syntax parser.");
	this.parser = parser;
  }
  
  /**
   * Retrieves the command's unique id.
   * 
   * @return the command's unique id.
   */
  @Override
  public int getCommandId() {
    return serialUid;
  }

  /**
   * Retrieves the syntax parser.
   * 
   * @return the syntax parser.
   */
  public SyntaxHandler getParser() {
    return parser;
  }

  /**
   * Sets the syntax parser.
   * 
   * @param parser the syntax parser.
   */
  public void setParser(SyntaxHandler parser) {
    this.parser = parser;
  }

}
